package [basepackage].tools;

import java.io.Serializable;

import net.wicp.tams.common.others.RedisClient;
import redis.clients.jedis.Jedis;

public abstract class BusiAssit {
	public static <T extends Serializable> T findByRedis(Class<T> calssz, String key) {
		Jedis jedis = RedisClient.getConnection();
		try {
			T t = RedisClient.getObjByMapValue(calssz, jedis, key);
			return t;
		} finally {
			RedisClient.returnResource(jedis);
		}
	}

	public static <T extends Serializable> void putRedis(T saveobj, String key) {
		Jedis jedis = RedisClient.getConnection();
		try {
			RedisClient.putObjByMap(jedis, key, saveobj);
		} finally {
			RedisClient.returnResource(jedis);
		}
	}
}
